package com.aaa.tmr.controller;


import com.aaa.tmr.entity.User;
import com.aaa.tmr.service.MenuService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;


/**
 * 菜单权限表(Menu)表控制层
 *
 * @author makejava
 * @since 2021-03-17 15:30:46
 */
@Controller
@RequestMapping("back")
public class BackIndexController {

    /**
     * 服务对象
     */
    @Resource
    private MenuService menuService;


    /**
     * 跳转后台管理页面
     */
    @RequestMapping("toIndex")
    public String toIndex(HttpSession session, Model model) {
        User user = (User) session.getAttribute("userInfo");
        model.addAttribute("menuListByUid", menuService.queryMenuByUid(user == null ? 0 : user.getUserId()));

        return "back/index";
    }
}